/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jobs.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Paul Tamayo
 */
@Entity
@Table(name = "activity")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Activity.findAll", query = "SELECT a FROM Activity a"),
    @NamedQuery(name = "Activity.findById", query = "SELECT a FROM Activity a WHERE a.id = :id"),
    @NamedQuery(name = "Activity.findByName", query = "SELECT a FROM Activity a WHERE a.name = :name"),
    @NamedQuery(name = "Activity.findByDescription", query = "SELECT a FROM Activity a WHERE a.description = :description")})
public class Activity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "name")
    private String name;
    @Size(max = 200)
    @Column(name = "description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "activityId")
    private Collection<Knowledge> knowledgeCollection;
    @JoinColumn(name = "technical_skill_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TechnicalSkill technicalSkillId;
    @JoinColumn(name = "relevance_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Relevance relevanceId;
    @JoinColumn(name = "jobs_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Jobs jobsId;
    @JoinColumn(name = "interface_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Interface interfaceId;
    @JoinColumn(name = "id_frequency", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Frequency idFrequency;
    @JoinColumn(name = "id_concequence", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Concequence idConcequence;
    @JoinColumn(name = "id_complexity", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Complexity idComplexity;
    @JoinColumn(name = "behavior_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Behavior behaviorId;

    public Activity() {
    }

    public Activity(Integer id) {
        this.id = id;
    }

    public Activity(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Knowledge> getKnowledgeCollection() {
        return knowledgeCollection;
    }

    public void setKnowledgeCollection(Collection<Knowledge> knowledgeCollection) {
        this.knowledgeCollection = knowledgeCollection;
    }

    public TechnicalSkill getTechnicalSkillId() {
        return technicalSkillId;
    }

    public void setTechnicalSkillId(TechnicalSkill technicalSkillId) {
        this.technicalSkillId = technicalSkillId;
    }

    public Relevance getRelevanceId() {
        return relevanceId;
    }

    public void setRelevanceId(Relevance relevanceId) {
        this.relevanceId = relevanceId;
    }

    public Jobs getJobsId() {
        return jobsId;
    }

    public void setJobsId(Jobs jobsId) {
        this.jobsId = jobsId;
    }

    public Interface getInterfaceId() {
        return interfaceId;
    }

    public void setInterfaceId(Interface interfaceId) {
        this.interfaceId = interfaceId;
    }

    public Frequency getIdFrequency() {
        return idFrequency;
    }

    public void setIdFrequency(Frequency idFrequency) {
        this.idFrequency = idFrequency;
    }

    public Concequence getIdConcequence() {
        return idConcequence;
    }

    public void setIdConcequence(Concequence idConcequence) {
        this.idConcequence = idConcequence;
    }

    public Complexity getIdComplexity() {
        return idComplexity;
    }

    public void setIdComplexity(Complexity idComplexity) {
        this.idComplexity = idComplexity;
    }

    public Behavior getBehaviorId() {
        return behaviorId;
    }

    public void setBehaviorId(Behavior behaviorId) {
        this.behaviorId = behaviorId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Activity)) {
            return false;
        }
        Activity other = (Activity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jobs.jpa.Activity[ id=" + id + " ]";
    }
    
}
